﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using DTGroup_ZheJiang.Models;
using DTGroup_ZheJiang.Business;
using DTGroup.Networking.Framework.Utils.Web;
namespace DTGroup_ZheJiang.WebUI
{
    public partial class Login : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                string userName = RequestUtil.GetString("userName");
                string userPwd = RequestUtil.GetString("userPwd");
                string Options = RequestUtil.GetString("Options");
                if (Options == "UserLogin")
                {
                    UserLogin(userName, userPwd);
                }
            }
        }

        public void UserLogin(string userName, string userPwd)
        {
            //try
            //{
            //User u = new User();
            //{
            //    UserName = "123",
            //    Password = "456"
            //};

            User u = UserBO.Login(userName, userPwd);
            if (u.UserName != null)
            {

                Response.Write("1");
                Response.End();
                //HttpContext.Current.ApplicationInstance.CompleteRequest();
            }
            else
            {
                Response.Write("0");
                Response.End();
            }
            //}
            //catch (Exception ex)
            //{
            //    Response.Write("0" + "," + ex.Message);
            //    Response.End();

            //}
        }
    }
}